package com.cosina.game.tank.model;

import android.graphics.Color;
import android.graphics.Point;

import com.cosina.game.tank.Constants;
import com.cosina.game.tank.util.Direction;
import com.cosina.game.tank.util.DirectionAdapter;

public class Pill extends DirectionAdapter implements TimeElapse{
	
	private Point location;
	private Direction direction;
	private boolean belongEnemy;
	public Pill(Point location, Direction direction, boolean belongEnemy){
		this.location = location;
		this.direction = direction;
		this.belongEnemy = belongEnemy;
	}

	public int getX(){ return this.location.x;}
	public int getY(){ return this.location.y;}
	
	public boolean belongEnemy(){
		return belongEnemy;
	}
	
	public Point getLocation() {
		return location;
	}

	public int getColor(){
		if(belongEnemy){
			return Color.RED;
		}else{
			return Color.GREEN;
		}
	}
	
	@Override
	public void withTimeGo() {
		this.doSwtich(direction);
	}

	@Override
	public Object doDown() {
		location.y += Constants.speed;
		return null;
	}

	@Override
	public Object doLeft() {
		location.x -= Constants.speed;
		return null;
	}

	@Override
	public Object doRight() {
		location.x += Constants.speed;
		return null;
	}

	@Override
	public Object doUp() {
		location.y -= Constants.speed;
		return null;
	}
}
